<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试Native和WebView交互</title>
    <style type="text/css">
        body {
            background-color: #cccccc;
        }

    </style>
</head>
<body background="">
<script type="text/javascript">
    function loadUrl() {
        document.getElementById("content").innerHTML +=
            "<br\>Native调用loadUrl，无参";
    }

    function loadUrlArgs(data) {
        document.getElementById("content").innerHTML +=
            ("<br\>Native调用loadUrlArgs，有参:" + data);
    }

    function evaluateJavascript() {
        document.getElementById("content").innerHTML +=
            "<br\>Native调用evaluateJavascript，无参";
        //返回数据
        return "js->native1"
    }

    function evaluateJavascriptArgs(data) {
        document.getElementById("content").innerHTML +=
            ("<br\>Native调用evaluateJavascriptArgs，有参:" + data);
        //返回数据
        return "js->native2"
    }

    function jsCallNative() {
        console.log("jsCallNative")
        window.NativeToJsBridge.call()
    }

    function jsCallNativeWithArgs(data) {
        console.log("jsCallNativeWithArgs:" + data)
        window.NativeToJsBridge.callWithArgs("js调用参数" + data)
    }

</script>

<h2>调用native方法</h2>
<input type="button" value="调用Java方法(无参)1" onclick="NativeToJsBridge.call()"/><br/>
<input type="button" value="调用Java方法(无参)3" onclick="jsCallNative()"/><br/>
<hr/>
<input type="button" value="调用Java方法(有参)1" onclick="NativeToJsBridge.callWithArgs('我是来自js的参数')"/><br/>
<input type="button" value="调用Java方法(有参)3" onclick="jsCallNativeWithArgs('html')"/><br/>
<hr/>

<h2>被native调用</h2>
<div id="content">内容显示</div>
</body>
</html>
